package com.s10.ecloud.web.model;

// default package

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "DISTRICT", catalog = "ECLOUD")
public class District implements java.io.Serializable {

	private static final long serialVersionUID = 1L;

	private Integer id;

	private City city;

	private Integer number = 0;
	private Integer weight = 0;
	private String name;

	// Constructors

	/** default constructor */
	public District() {
	}

	/** full constructor */
	public District(City city, Integer eId, String name) {
		this.city = city;
		this.number = eId;
		this.name = name;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "NUMBER", length = 50)
	public Integer getNumber() {
		return this.number;
	}

	public void setNumber(Integer e) {
		this.number = e;
	}

	@Column(name = "NAME", length = 40)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "WEIGHT", length = 50)
	public Integer getWeight() {
		return weight;
	}

	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CITY_ID")
	public City getCity() {
		return city;
	}

	public void setCity(City city) {
		this.city = city;
	}
}